unit OrderProcessing;

interface

uses Winapi.Windows;

procedure DoOrderProcessing;

implementation

uses
   Order, OrderValidator, OrderEntry, OrderProcessor, Spring.XE.Core, Spring.XE.Utils;

procedure DoOrderProcessing;
var
  Order: TOrder;
  OrderProcessor: TOrderProcessor;
  oPC: TApplicationContext;
begin
  oPC := TApplicationContext.Create;
  Order := TOrder.Create;
  try
    OrderProcessor := TOrderProcessor(oPC.GetBean('processor').AsObject);
    try
      if OrderProcessor.ProcessOrder(Order) then
      begin
        WriteLn('Order successfully processed....');
      end;
    finally
      OrderProcessor.Free;
    end;
  finally
    oPC.Free;
    Order.Free;
  end;
end;

end.
